package com.swq.java.code.chapter09.code06;


import com.swq.java.code.chapter09.code03.CarWrongException;
import com.swq.java.code.chapter09.code04.LateException;
import com.swq.java.code.chapter09.code05.Car;

import java.util.Date;

/**
 * @author xi.yang
 * @create 2019-05-15 20:21
 **/
public class Worker {
    private Car car;

    public Worker(Car car) {
        this.car = car;
    }

    public void gotoWork() throws LateException {
        try {
            car.run();
        } catch (CarWrongException e) {
            walk();
            Date date = new Date();
            throw new LateException(date,e.getMessage());
        }
    }

    private void walk() {

    }
}
